package com.lifesting.ganttviewer.model;

import java.util.ArrayList;
import java.util.List;

public class GTask  extends GWorkingItem{
	/**
	 * 
	 */
	private static final long serialVersionUID = -6139148075440477737L;
	public static final String PREDECESSOR_CHANGED="PREDECESSOR_CHANGED";
	protected List<GPredecessor> predecessors;
	protected int completed;
	protected int priority;
	public int getCompleted() {
		return completed;
	}
	public void setCompleted(int completed) {
		this.completed = completed;
	}
	public int getPriority() {
		return priority;
	}
	public void setPriority(int priority) {
		this.priority = priority;
	}
	public void addPredecessor(GPredecessor predecessor){
		if (predecessors == null)
			predecessors = new ArrayList<GPredecessor>();
		predecessors.add(predecessor);
		propertySupport.firePropertyChange(PREDECESSOR_CHANGED, null, predecessor);
	}
	public void removePredecessor(GPredecessor predecessor)
	{
		predecessors.remove(predecessor);
		propertySupport.firePropertyChange(PREDECESSOR_CHANGED, predecessor, null);
	}
	public List<GPredecessor> getPredecessors() {
		return predecessors;
	}
}
